#include <opencv2/opencv.hpp>
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
 
 
using namespace cv;
using namespace std;
 
 
int number = 1;
char imgdir[100];
string imgdirname;
VideoCapture cap("test.h264");
int main()
{	
	int num=0;
	while (1) {
		Mat resizeimg, img;
		cap >> img;
		num++;
	    if (img.empty())
			break;
		if (num == 50){// 五十帧存一张
			sprintf(imgdir, "%s%06d%s", "D:/191215937/", number++, ".jpg");
			imgdirname = imgdir;
			imwrite(imgdirname, img);
			num = 0;
		}
	}
	return 0;
}